/**
 * Created by Yang on 2014/8/29.
 */
var request = require('request');
var wxToken = require('./wxToken');
exports.set = function(menuJson,next,back){
    var createMenuUrl = 'https://api.weixin.qq.com/cgi-bin/menu/create?'
        + 'access_token=' + wxToken.getAccessToken();

    request.post({
        url:createMenuUrl,
        json:menuJson
    },function(err,res,body){
        if (!err && res.statusCode == 200) {
            next(body);
        }else{
            back(err);
        }
    })
}